package com.lyy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lyy.entity.Episode;
import com.lyy.mapper.EpisodeMapper;
import com.lyy.service.EpisodeService;
import lombok.Data;
import lombok.Setter;

import java.util.List;

/**
 * @author Liangyaoyun
 */
@Data
@Setter
public class EpisodeServiceImpl implements EpisodeService {
    private EpisodeMapper episodeMapper;

    @Override
    public int insertByEpisodeId(Episode episode) {
        return episodeMapper.insertByEpisodeId(episode);
    }

    @Override
    public int updateByEpisodeId(Episode episode) {
        return episodeMapper.updateByEpisodeId(episode);
    }

    @Override
    public int deleteByEpisodeId(Integer episodeId) {
        return episodeMapper.deleteByEpisodeId(episodeId);
    }

    @Override
    public int deleteByEpisodeIds(List<Integer> episodeId) {
        return episodeMapper.deleteByEpisodeIds(episodeId);
    }

    @Override
    public Episode selectByEpisodeId(Integer episodeId) {

        return episodeMapper.selectByEpisodeId(episodeId);
    }

    @Override
    public List<Episode> selectAllEpisode() {
        return episodeMapper.selectAllEpisode();
    }

    @Override
    public PageInfo<Episode> selectBypage(Integer pageNumber, Integer pageSize) {
        PageHelper.startPage(pageNumber,pageSize);
        return new PageInfo<>(episodeMapper.selectAllEpisode());
    }
}
